package cn.jinjimi.domain.store;

import cn.jinjimi.domain.data.dto.AppConfigsDTO;
import cn.jinjimi.domain.data.dto.DynamicDTO;
import cn.jinjimi.domain.data.dto.InfoModulesDTO;
import cn.jinjimi.domain.data.dto.MaterialDTO;
import cn.jinjimi.domain.data.dto.NoticeDto;
import cn.jinjimi.domain.data.dto.PlanProductDTO;
import cn.jinjimi.domain.data.dto.HeadLineDTO;
import cn.jinjimi.app.entity.ActivityInfo;
import cn.jinjimi.app.entity.AppConfig.AppConfigs;
import cn.jinjimi.app.entity.AppConfig.AppModule;
import cn.jinjimi.app.entity.AppConfig.AppStartPic;
import cn.jinjimi.app.entity.Area;
import cn.jinjimi.app.entity.Products;

import org.json.JSONException;

import java.io.IOException;
import java.util.List;

/**
 * Created by zhenhua on 16/7/7.
 */
public interface ConfigStore {

    void updateAppConfigs(AppConfigs appConfigs);

    String getConfig(String name);

    AppStartPic getStartPic();

    /**
     * get configs of global
     *
     * @return
     */
    AppConfigs get() throws IOException;

    /**
     * get configs of module
     *
     * @param module
     * @return
     */
    AppModule get(String module) throws IOException, JSONException;

    void save(AppConfigsDTO.AppConfig data);

    AppConfigs fetchConfigs() throws IOException;

    AppModule fetchConfigsOfURL(String url) throws IOException, JSONException;

    AppModule fetchConfigOfModule(String name) throws Exception;

    InfoModulesDTO fetchDynamicMeMenu() throws IOException;

    Area fetchAreaList() throws IOException;

    Area fetchCities(String provinceId) throws IOException;

    List<Products> getProducts() throws IOException;

    List<ActivityInfo> getActivities() throws IOException;

    HeadLineDTO getHomeHeadLine() throws IOException;

    DynamicDTO getHomeDynamics() throws IOException;

    ActivityInfo getActivityInfo(ActivityInfo activityInfo) throws IOException;

    NoticeDto getNoticeList() throws IOException;

    /**
     * 展业素材列表
     *
     * @return
     * @throws IOException
     */
    MaterialDTO getAppMaterials() throws IOException;

    /**
     * 计划书列表
     *
     * @param companyId
     * @return
     * @throws IOException
     */
    PlanProductDTO getPlanProducts(int companyId) throws IOException;
}